/**
 * 文字类型
 *   将某字符串变量设置成唯一固定的值(类型与值一致)，后续不可更改
 *   类似与用关键字const定义变量
 */
let str1:string = 'thc'
str1 = 'kino'
const str2 = '我爱打水'

let str3:'kino' = 'kino'
// str3 = 'thc'

function prText(str: string, alignment: 'kino'|'thc'|'我爱打水'){
    console.log(`${str} ${alignment}`)
}
prText('hello', 'kino')

const requstParams = {
    url: '/api/getData',
    method: 'GET',
    params: {
        id: '8292278292',
        name: 'kino'
    }
} as const  
/*
* 虽是用const定义了requestParams,但依旧可以更改method的值，
* 造成method值不确定性， 可以通过类型断言（as const）来固定值(设置只读模式)
*/
// requstParams.method = 'DELETE'
function requestFn(url:string, params:object, method: 'GET'|'POST'|'PUT'){

}
requestFn(requstParams.url, requstParams.params, requstParams.method)